/**
 * @(#)Text5.java
 *
 *
 * @author 
 * @version 1.00 2011/10/30
 */


public class treadmill {
	public static final double maxSpeed = 15;		//15 MPH
	public static final double maxIncline = 20 * (3.141592 / 180);	//20 Degrees
	private static double current_speed = 0;
	private static double current_incline = 0;
	
	/* Accessors for Speed and Incline */
	
	//	Return the current speed
    public static double get_current_speed(){
    	return current_speed;
    }
    //	Return the current Incline
    public static double get_current_incline(){
    	return current_incline;
    }
    
    /* Modifiers for Speed and incline. */
    //	Increase & Decrease Speed by .1 MPH
    public static void increase_current_speed(){
    	double temp = current_speed + .1;
    	if (temp >= 0){
    		 if (temp <= maxSpeed) current_speed = temp;
    	}
    	
    }
    public static void decrease_current_speed(){
    	double temp = current_speed - .1;
    	if (temp >= 0){
    		 if (temp <= maxSpeed) current_speed = temp;
    	}
    	
    }
    //	Increase & Decrease Incline by .1 MPH
    public static void increase_current_incline(){
    	double temp = current_incline + (3.141592 / 180);
    	if (temp >= 0){
    		 if (temp <= maxIncline) current_incline = temp;
    	}    	
    }
    public static void decrease_current_incline(){
    	double temp = current_incline - (3.141592 / 180);
    	if (temp >= 0){
    		 if (temp <= maxIncline) current_incline = temp;
    	}    	
    }
    //Reset treadmill speed & incline to 0.
    public static void reset(){
        current_speed = 0;
        current_incline = 0;
    }
    //	Increase & Decrease Speed by any amount
    //  Todo: Change these methods so that they start a thread to
    //        Change speed and incline over time.
    public static void change_current_speed(double value){
    	double temp = current_speed + value;
    	if (temp >= 0){
    		 if (temp <= maxSpeed) current_speed = temp;
    	}
    }
    public static void change_current_incline(double value){
    	double temp = current_incline + value;
    	if (temp >= 0){
    		 if (temp <= maxIncline) current_incline = temp;
    	}
    }
    //	Set the speed or incline to a specific value.
    public static void set_current_speed(double value){
	double temp = value;
    	if (temp >= 0){
    		 if (temp <= maxSpeed) current_speed = temp;
    	}    	
    }
    public static void set_current_incline(double value){
        double temp = value;
    	if (temp >= 0){
    		 if (temp <= maxIncline) current_incline = temp;
    	}    	
    }            
}